package kpi.javatraining6.gnatiuk.tests;

import kpi.javatraining6.gnatiuk.src.tester.readers.QuestionFactory;
import kpi.javatraining6.gnatiuk.src.tester.readers.QuestionValues;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;

import java.util.ArrayList;

public class QuestionFactoryTest {
    QuestionValues values;
    @Before
    public void setUp() {
        values = new QuestionValues("EASY", "", new ArrayList<String>(), new ArrayList<String>());
    }

    @Test(expected = ClassNotFoundException.class)
    public void testGetQuestionForBothNullArguments() throws Exception {
        QuestionFactory.getQuestion(null, null);
    }

    @Test(expected = ClassNotFoundException.class)
    public void testGetQuestionForSecondNullArgument() throws Exception {
        QuestionFactory.getQuestion("something", null);
    }

    @Test(expected = ClassNotFoundException.class)
    public void testGetQuestionForFirstNullArgument() throws Exception {
        QuestionFactory.getQuestion(null , values);
    }

    @Test(expected = ClassNotFoundException.class)
    public void testGetQuestionForWrongTypeArgument() throws Exception {
        QuestionFactory.getQuestion("wrong type" , values);
    }

    /*just for code coverage*/
    @Test
    public void testQuestionFactoryInstantiation() {
          QuestionFactory factory = new QuestionFactory();
        assertEquals(QuestionFactory.class, factory.getClass());
    }
}
